package ru.amse.tsyganov.jumleditor.view.lines;

import ru.amse.tsyganov.jumleditor.view.ConnectionPoint;

public abstract class FromConnectionPointLine extends ConnectionPointLine {
	
	public FromConnectionPointLine(ConnectionPoint p, int cord) {
		super(p, cord);
	}

	public int getX1() {
		return getConnectionPoint().getCpX();
	}

	public int getY1() {
		return getConnectionPoint().getCpY();
	}
	
	public void setX1(int x1) {
		throw new UnsupportedOperationException();
	}

	public void setY1(int y1) {
		throw new UnsupportedOperationException();
	}

	public static FromConnectionPointLine createNewFromConnectionPointLine(
			ConnectionPoint p, boolean isHorizontal, int cord) {
		
		return isHorizontal ? 
				new HorizontalFromConnectionPointLine(p, cord) :
					new VerticalFromConnectionPointLine(p, cord);
	}
}
